# -*- coding: UTF-8 -*-
"""
@Filename:exerc3.py
@author:Cora
@time:2025-04-25
"""

import json

class UserInfo:
    def __init__(self, name, age, email):
        self.name = name
        self.age = age
        self.email = email

    def __str__(self):
        return f"Name: {self.name}, Age: {self.age}, Email: {self.email}"

#读取json.txt文件
with open("json.txt", "r") as file:
    data = json.load(file)

#封装为UserInfo对象并存入列表
users = [UserInfo(user["name"], user["age"], user["email"]) for user in data]

#遍历列表输出所有用户信息
for user in users:
    print(user)